import React, {useState} from 'react';
import {Button, Table, Tag} from 'antd';

function ReceivingList(props) {

  const [columns, setColumns] = useState([
    {
      title: '产品',
      key: 'goods_logo',
      render: (text, record) => {
        // review === 1 未审核
        return <div className='BeforeOperatedAction'>
          <img style={{width: '70px'}} src={text.goods_logo}/>
        </div>;
      }
    }, {
      title: '产品名称',
      dataIndex: 'goods_title',
      key: 'goods_title'
    }, {
      title: '退货数量',
      dataIndex: 'refund_num',
      key: 'refund_num'
    },
    {
      title: '产品状态',
      dataIndex: 'goods_spec',
      key: 'goods_spec'
    },
    {
      title: '订单号',
      dataIndex: 'order_no',
      key: 'order_no'
    }, {
      title: '供应商',
      dataIndex: 'vendor_name',
      key: 'vendor_name'
    },
    {
      title: '运单号',
      dataIndex: 'refund_express_no',
      key: 'refund_express_no'
    },
    {
      title: '创建时间',
      dataIndex: 'create_at',
      key: 'create_at'
    }, {
      title: '状态',
      key: 'review',
      render: (text, record) => {
        // review === 1 未审核
        return <div className='BeforeOperatedAction'>
          {
            text.review === 5 && <Tag size='small' color={'gold'}>已收货</Tag>
          }
          {
            text.review === 2 && <Tag size='small' color={'green'}>未收货</Tag>
          }

        </div>;
      }
    }, {
      title: '操作',
      key: 'action',
      render: (text, record) => {
        // review: 1    0未提交 1退款申请已提交 2退款申请通过 3退款申请不通过 4退货已提交 5退货收到 6退货没收到 7同意退款 8退款成功
        return <div className='BeforeOperatedAction'>
          {
            text.review == 4 && <Button size={'small'} type={'default'}
                                        onClick={() => props.tempConfirmReceipt(text.refund_no)}>确认收货</Button>
          }

        </div>;
      }
    }

  ]);

  return (
    <div className={'SupplierOrderList'}>
      <Table dataSource={props.receivingList} columns={columns} pagination={false}/>
    </div>
  );
}


export default ReceivingList;
